package demo8;

import demo1.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ScannTes {

    @Test
    public void test1() {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean8.xml");
        UserService service = context.getBean("userService", UserService.class);
        System.out.println(service);

        UserBean userBean = context.getBean("userBean", UserBean.class);
        System.out.println(userBean);

        UserController userController = context.getBean("userController", UserController.class);
        System.out.println(userController);
    }

    @Test
    public void test2() {
        ApplicationContext context = new ClassPathXmlApplicationContext("bean9.xml");
        UserService service = context.getBean("userService", UserService.class);
        System.out.println(service);
        UserBean userBean = context.getBean("userBean", UserBean.class);
        System.out.println(userBean);
//
//        UserController userController = context.getBean("userController", UserController.class);
//        System.out.println(userController);
    }
}
